package org.eyeTopLight.service.impl;

import org.eyeTopLight.dao.ShoppingCartDao;
import org.eyeTopLight.po.ShoppingCart;
import org.eyeTopLight.exception.ErrorCode;
import org.eyeTopLight.exception.ExceptionHandler;
import org.eyeTopLight.service.ShoppingCartService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.annotation.Resource;

public class ShoppingCartServiceImpl implements ShoppingCartService {

    /**
     * 打印日志
     */
    private static final Logger logger = LoggerFactory.getLogger(ShoppingCartServiceImpl.class);

    @Resource
    ShoppingCartDao shoppingCartDao;

    @Override
    public ShoppingCart getShoppingCartById(ShoppingCart shoppingCart) {
        ShoppingCart shoppingCartEntity = null;
        try{
            shoppingCartEntity = shoppingCartDao.queryByPK(shoppingCart);
        }
        catch (Exception e){
            logger.error("查询数据库shoppingCart表操作失败",e);
            ExceptionHandler.processError(ErrorCode.ERR_DB_SELECT.getValue(),"查询数据库shoppingCart表操作失败");
        }
        return shoppingCartEntity;

    }
}
